/**
 * Copyright (C) 2010 CloudApply Inc., All Rights Reserved.
 */
package com.xyzh05.model;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * 文书定单
 * 
 * @author Longshine
 *
 */
public class Order {
	private static DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
	private Editor editor;
	private Pricing pricing;
	private Integer schoolNum;
	
	/**
	 * 生成定单编号
	 * @return
	 */
	public static String newOrderId() {
		String rand = String.valueOf(Double.valueOf(Math.random() * 100).intValue());
		if (rand.length() == 1)
			rand = "0" + rand;
		return df.format(Calendar.getInstance().getTime()) + rand;
	}

	/**
	 * 生成定单
	 * @param editor 提供服务的编辑
	 * @param pricing 定单相关的服务定价
	 */
	public Order(Editor editor, Pricing pricing) {
		this.editor = editor;
		this.pricing = pricing;
	}

	/**
	 * 获取定单相关的服务定价
	 * @return
	 */
	public Pricing getPricing() {
		return pricing;
	}

	public void setPricing(Pricing pricing) {
		this.pricing = pricing;
	}

	public void setEditor(Editor editor) {
		this.editor = editor;
	}

	/**
	 * 获取提供服务的编辑
	 * @return
	 */
	public Editor getEditor() {
		return editor;
	}

	/**
	 * 设置定单学校数量
	 * @param schoolNum
	 */
	public void setSchoolNum(Integer schoolNum) {
		this.schoolNum = schoolNum;
	}

	/**
	 * 获取定单学校数量
	 * @return
	 */
	public Integer getSchoolNum() {
		return schoolNum;
	}
}
